<?php

return [
    'index'=>[
        'controller'=>[],
        'logic'=>[],
        'model'=>[]
    ],
    'admin'=>[
        'controller'=>[
            'Role'=>[
                'comment'=>'角色管理',
                'except_login'=>'',
                'api_cat'=>'',
                'methods'=>[
                    'role'=>[
                        'comment'=>'角色',
                        'call_namespace'=>'app\admin\logic',
                        'call_logic'=>'RoleLogic',
                        'call_pk'=>'role_id',
                        'method_prefix'=>'Role',
                        'logic_list'=>[
                            'add'=>[
                                'param'=>'role_name|1|角色名称,role_desc|0|角色描述',
                                'route'=>'',
                            ],
                            'list'=>[
                                'param'=>'role_name|0|角色名称,role_desc|0|角色描述',
                                'route'=>'',
                                'with'=>null,
                                'order'=>null,
                            ],
                            'update'=>[
                                'param'=>'role_id|1|角色ID,role_name|0|角色名称,role_desc|0|角色描述',
                                'route'=>'',
                                'with'=>null,
                            ],
                            'delete'=>[
                                'param'=>'role_id|1|角色ID',
                                'route'=>'',
                            ]
                        ],
                    ],
                    'statusChange'=>[
                        'comment'=>'启用禁用',
                        'call_namespace'=>'app\admin\logic',
                        'call_logic'=>'RoleLogic',
                        'call_method'=>'roleUpdate',
                        'call_type'=>'update',
                        'call_pk'=>'role_id',
                        'route'=>'/role/status',
                        'req_method'=>'post',
                        'param'=>'role_id|1|角色ID,status|1|状态 0 禁用 1 启用',                        
                    ],
                ],
            ],
        ],
        'logic'=>[
            'Role'=>[
                'comment'=>'角色管理',
                'logic_model'=>[
                    'Role'=>[
                        'namespace'=>'app\model',
                        'comment'=>'角色',
                        'pk'=>'role_id',
                        'functions'=>[
                            'add'=>'',
                            'update'=>[
                                'allowField'=>'["role_name","role_desc"]',
                                'with'=>'[]',
                            ],
                            'delete'=>['with'=>''],
                            'list'=>[
                                'wconfig'=>'["role_name"=>["role_name","like"]]',
                                'with'=>'[]',
                                'order'=>'["role_id"=>"DESC"]'
                            ],
                            'info'=>'',
                        ]
                       
                    ]
                ],
            ],
        ],
        'model'=>[]
    ],
    'model'=>[
        'Admin'=>[
            'test'=>[
                'model'=>'Role',
                'type'=>'BelongsTo',
                'foreignKey'=>'role_id',
                'localKey'=>'role_id',
                'joinType'=>'LEFT',
                'bind'=>'["role_name"]',
                'comment'=>'角色关联'
            ],
            'createadmin'=>[
                'model'=>'Admin',
                'type'=>'BelongsTo',
                'foreignKey'=>'admin_id',
                'localKey'=>'admin_id',
                'joinType'=>'LEFT',
                'bind'=>'["create_admin"=>"admin_name"]',
                'comment'=>'创建人'
            ]
        ],
    ],
];